<template>
	<view class="">
		<view class="Topbg">
			<view class="info">
				<view class="u-flex">
					<u-image :src="info.avter" width="80" height="80" shape="circle"></u-image>
					<view class="u-margin-left-20">
						<view class="">
							<view style="color: #FFFFFF;font-size: 34rpx;">{{info.name}}</view>
							<u-image :src="info.dengji" width="105" height="53" v-if="info.dengji"></u-image>
						</view>
					</view>
				</view>


				<view style="text-align: center;" @click="qiandao">
					<view>
						<u-icon name="calendar" size="50" color="#fff"></u-icon>
					</view>
					<view class="" style="font-size: 24rpx;color: #FFFFFF;">
						签到
					</view>
				</view>
			</view>

		</view>


		<view class="move">
			<view class="classList">
				<u-grid :col="5" :border="false">
					<u-grid-item v-for="(item,index) in classList" :key="index" index="item" @click="clickGrid1(item)">
						<u-image :src="item.img" width="100" height="100"></u-image>
						<view class="grid-text">{{item.txt}}</view>
					</u-grid-item>
				</u-grid>
			</view>

			<view style="width:690rpx ;margin:40rpx auto;" class="u-flex u-row-between">
				
			   <u-image :src="imagesurl+'/images/fxbanner.png'" width="330" height="140" @click="fenxiao"></u-image>
			   <u-image :src="imagesurl+'/images/kjbanner.png'" width="330" height="140" @click="kanjian"></u-image>
			</view>

<!-- 
			<view style="margin:auto;width: 140rpx;">
				<u-image src="/static/booktitle.png" width="140" height="60"></u-image>
			</view>

			<view style="margin: 40rpx 0;">
				<u-grid :col="5" :border="false">
					<u-grid-item v-for="(item,index) in bookList" :key="index" index="item" @click="clickGrid2(item)">
						<u-image :src="item.img" width="80" height="80"></u-image>
						<view class="grid-text">{{item.txt}}</view>
					</u-grid-item>
				</u-grid>
			</view> -->



			<view class="classrow">
				<u-cell-group>
					<u-cell-item title="地址管理" @click="cell('../address/index')"></u-cell-item>
					<u-cell-item title="账号信息" @click="cell('../info/index')" v-if="Number(appAuditState)"></u-cell-item>
					<u-cell-item title="联系客服" class="share">
						<button open-type="contact"></button>
					</u-cell-item>
				</u-cell-group>

			</view>


		</view>






	</view>
</template>

<script>
	import url from '@/common/baseUrl.js';
	export default {

		data() {
			return {
				appAuditState:1,
				imagesurl: url.imageUrl,
				info: {
					avter: "",
					name: "",
					dengji: ""
				},
				classList: [{
					img: url.imageUrl+"/images/my_4.png",
					txt: "钱包",
					url: "../../pages/my/wallet"
				}, {
					img: url.imageUrl+"/images/my_3.png",
					txt: "积分",
					url: "../../pages/my/jifen"
				}, {
					img: url.imageUrl+"/images/my_1.png",
					txt: "代金券",
					url: "../../pages/my/coupond"

				}, {
					img: url.imageUrl+"/images/my_5.png",
					txt: "金币",
					url: "../../pages/my/gloden"
				} ,{
					img: url.imageUrl+"/images/my_2.png",
					txt: "话费券",
					url: "../../pages/my/phone"
				}],

				bookList: [{

					img: url.imageUrl+"/images/order_df.png",
					txt: "待付款",
					url: "../../pages/book/index?block=1"
				}, {
					img: url.imageUrl+"/images/order_dfh.png",
					txt: "待发货",
					url: "../../pages/book/index?block=2"
				}, {
					img: url.imageUrl+"/images/order_dsh.png",
					txt: "待收货",
					url: "../../pages/book/index?block=3"
				}, {
					img: url.imageUrl+"/images/order_wc.png",
					txt: "已完成",
					url: "../../pages/book/index?block=4"
				}, {
					img: url.imageUrl+"/images/order_sh.png",
					txt: "售后",
					url: "../../pages/book/index?block=5"
				}]

			}
		},
		onLoad() {
			this.getConfig()
		},
		onShow() {
			this.$u.post('/api/user/information', {
				
			}, {}).then(res => {
				var {headimg,levelId,nickname}=res.data;
				this.info.avter=headimg;
				this.info.name=nickname;
			   
				if(levelId==1){
			   	this.info.dengji="/static/degree_1.png"
				}
				if(levelId==2){
				this.info.dengji="/static/degree_2.png"
				}
				if(levelId==3){
				this.info.dengji="/static/degree_3.png"
				}
				if(levelId==0){
				 this.info.dengji=""
				}
				
				
				
			}).catch(err => {})
			
		},
		methods: {
			getConfig(){
			this.$u.post('/api/index/getConfig', {
			
			}, {}).then(res => {
				 if(!Number(res.data.appAuditState)){
					 this.classList.splice(0,1)
					  this.appAuditState=res.data.appAuditState
				 }
			     
			}).catch(err => {})
			},
			qiandao(){
				uni.navigateTo({
					url:"../getJinfen/index"
				})
			},
			clickGrid1(item) {

				uni.navigateTo({
					url: item.url
				})
			},
			clickGrid2(item) {
				uni.navigateTo({
					url: item.url
				})
			},
			fenxiao() {
				uni.navigateTo({
					url: "../fenxiaoCenter/index"
				})
			},
			kanjian(){
				uni.navigateTo({
					url: "../kanjia/index"
				})
			},
			cell(item) {
				uni.navigateTo({
					url: item
				})
			}
		}
	}
</script>

<style lang="scss">
	.Topbg {
		height: 300rpx;
		background: #628DFF;

		border-radius: 0rpx 0rpx 50% 50%;
		display: inline-block;
		width: 750rpx;

	}
	.share {
		
		position: relative;

		button {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			z-index: 999;
			opacity: 0;
		}
	}
	.info {
		display: flex;
		padding: 40rpx;
		justify-content: space-between;
	}

	.move {
		position: relative;
		bottom: 120rpx;
	}

	.classList {

		background: #FFFFFF;
		width: 690rpx;
		height: 200rpx;
		background: #FFFFFF;
		box-shadow: 0px 4rpx 6rpx rgba(209, 209, 209, 0.25);
		border-radius: 40rpx;
		left: 30rpx;
		margin: auto;

	}


	.classrow {
		width: 690rpx;

		background: #FFFFFF;
		box-shadow: 0px 4rpx 6rpx rgba(209, 209, 209, 0.26);
		border-radius: 20rpx;
		margin: 40rpx auto;
	}
</style>
